![]() |
Kinetis SDK API Reference Manual
1.0.0-beta
Freescale Semiconductor, Inc.
|
The section describes the programming interface of the SAI HAL driver. More...
Functions | |
| void | sai_hal_init (uint8_t instance) |
| Initializes the SAI device. More... | |
| void | sai_hal_set_tx_bus (uint8_t instance, sai_bus_t bus_mode) |
| Sets the bus protocol relevant settings for Tx. More... | |
| void | sai_hal_set_rx_bus (uint8_t instance, sai_bus_t bus_mode) |
| Sets the bus protocol relevant settings for Rx. More... | |
| static void | sai_hal_set_mclk_source (uint8_t instance, sai_mclk_source_t source) |
| Sets the master clock source. More... | |
| void | sai_hal_set_mclk_divider (uint8_t instance, uint32_t mclk, uint32_t src_clk) |
| Sets the divider of the master clock. More... | |
| static void | sai_hal_set_tx_bclk_source (uint8_t instance, sai_bclk_source_t source) |
| Sets the bit clock source of Tx. More... | |
| static void | sai_hal_set_rx_bclk_source (uint8_t instance, sai_bclk_source_t source) |
| Sets the bit clock source of Rx. More... | |
| static void | sai_hal_set_tx_blck_divider (uint8_t instance, uint32_t divider) |
| Sets the bit clock divider value of Tx. More... | |
| static void | sai_hal_set_rx_blck_divider (uint8_t instance, uint32_t divider) |
| Sets the bit clock divider value of Tx. More... | |
| static void | sai_hal_set_tx_frame_size (uint8_t instance, uint8_t size) |
| Sets the frame size for Tx. More... | |
| static void | sai_hal_set_rx_frame_size (uint8_t instance, uint8_t size) |
| Set the frame size for rx. More... | |
| static void | sai_hal_set_tx_word_size (uint8_t instance, uint8_t bits) |
| Set the word size for tx. More... | |
| static void | sai_hal_set_rx_word_size (uint8_t instance, uint8_t bits) |
| Sets the word size for Rx. More... | |
| static void | sai_hal_set_tx_word_zero_size (uint8_t instance, uint8_t size) |
| Sets the size of the first word of the frame for Tx. More... | |
| static void | sai_hal_set_rx_word_zero_size (uint8_t instance, uint8_t size) |
| Sets the size of the first word of the frame for Rx. More... | |
| static void | sai_hal_set_tx_sync_width (uint8_t instance, uint8_t width) |
| Sets the sync width for Tx. More... | |
| static void | sai_hal_set_rx_sync_width (uint8_t instance, uint8_t width) |
| Sets the sync width for Rx. More... | |
| static void | sai_hal_set_tx_watermark (uint8_t instance, uint8_t watermark) |
| Sets the watermark value for Tx FIFO. More... | |
| static void | sai_hal_set_rx_watermark (uint8_t instance, uint8_t watermark) |
| Sets the watermark value for Rx FIFO. More... | |
| void | sai_hal_set_tx_master_slave (uint8_t instance, sai_master_slave_t master_slave_mode) |
| Sets the master or slave mode of Tx. More... | |
| void | sai_hal_set_rx_master_slave (uint8_t instance, sai_master_slave_t master_slave_mode) |
| Sets the Rx master or slave mode. More... | |
| void | sai_hal_set_tx_sync_mode (uint8_t instance, sai_sync_mode_t sync_mode) |
| Transmits the mode setting. More... | |
| void | sai_hal_set_rx_sync_mode (uint8_t instance, sai_sync_mode_t sync_mode) |
| Receives the mode setting. More... | |
| uint8_t | sai_hal_get_fifo_read_pointer (uint8_t instance, sai_io_mode_t io_mode, uint8_t fifo_channel) |
| Gets the FIFO read pointer. More... | |
| uint8_t | sai_hal_get_fifo_write_pointer (uint8_t instance, sai_io_mode_t io_mode, uint8_t fifo_channel) |
| Gets the FIFO read pointer. More... | |
| uint32_t * | sai_hal_get_fifo_address (uint8_t instance, sai_io_mode_t io_mode, uint8_t fifo_channel) |
| Gets the TDR/RDR register address. More... | |
| static void | sai_hal_enable_tx (uint8_t instance) |
| Enables the Tx transmit. More... | |
| static void | sai_hal_enable_rx (uint8_t instance) |
| Enables the Rx receive. More... | |
| static void | sai_hal_disable_tx (uint8_t instance) |
| Disables the Tx transmit. More... | |
| static void | sai_hal_disable_rx (uint8_t instance) |
| Disables the Rx receive. More... | |
| void | sai_hal_enable_tx_interrupt (uint8_t instance, sai_interrupt_request_t source) |
| Enables the Tx interrupt from different interrupt sources. More... | |
| void | sai_hal_enable_rx_interrupt (uint8_t instance, sai_interrupt_request_t source) |
| Enables the Rx interrupt from different sources. More... | |
| void | sai_hal_disable_tx_interrupt (uint8_t instance, sai_interrupt_request_t source) |
| Disables the Tx interrupts from different interrupt sources. More... | |
| void | sai_hal_disable_rx_interrupt (uint8_t instance, sai_interrupt_request_t source) |
| Disables Rx interrupts from different interrupt sources. More... | |
| void | sai_hal_enable_tx_dma (uint8_t instance, sai_dma_request_t request) |
| Enables the Tx DMA request from different sources. More... | |
| void | sai_hal_enable_rx_dma (uint8_t instance, sai_dma_request_t request) |
| Enables the Rx DMA request from different sources. More... | |
| void | sai_hal_disable_tx_dma (uint8_t instance, sai_dma_request_t request) |
| Disables the Tx DMA request from different sources. More... | |
| void | sai_hal_disable_rx_dma (uint8_t instance, sai_dma_request_t request) |
| Disables the Rx DMA request from different sources. More... | |
| void | sai_hal_clear_tx_state_flag (uint8_t instance, sai_state_flag_t flag) |
| Clears the Tx state flags. More... | |
| void | sai_hal_clear_rx_state_flag (uint8_t instance, sai_state_flag_t flag) |
| Clears the state flags for Rx. More... | |
| void | sai_hal_reset_tx (uint8_t instance, sai_reset_type_t mode) |
| Resets the Tx. More... | |
| void | sai_hal_reset_rx (uint8_t instance, sai_reset_type_t mode) |
| Resets the Rx. More... | |
| static void | sai_hal_set_tx_word_mask (uint8_t instance, uint32_t mask) |
| Sets the mask word of the frame in Tx. More... | |
| static void | sai_hal_set_rx_word_mask (uint8_t instance, uint32_t mask) |
| Sets the mask word of the frame in Rx. More... | |
| static void | sai_hal_set_tx_fifo_channel (uint8_t instance, uint8_t fifo_channel) |
| Sets the FIFO Tx channel. More... | |
| static void | sai_hal_set_rx_fifo_channel (uint8_t instance, uint8_t fifo_channel) |
| Sets the Rx FIFO channel. More... | |
| void | sai_hal_set_tx_mode (uint8_t instance, sai_mode_t mode) |
| Sets the running mode. More... | |
| void | sai_hal_set_rx_mode (uint8_t instance, sai_mode_t mode) |
| Sets the Rx running mode. More... | |
| void | sai_hal_set_tx_bclk_swap (uint8_t instance, bool ifswap) |
| Set Tx bit clock swap. More... | |
| void | sai_hal_set_rx_bclk_swap (uint8_t instance, bool ifswap) |
| Sets the Rx bit clock swap. More... | |
| static void | sai_hal_set_tx_word_start_index (uint8_t instance, uint8_t index) |
| Configures on which word the start of the word flag is set. More... | |
| static void | sai_hal_set_rx_word_start_index (uint8_t instance, uint8_t index) |
| Configures on which word the start of the word flag is set. More... | |
| static void | sai_hal_set_tx_fbt (uint8_t instance, uint8_t index) |
| Sets the index in FIFO for the first bit data . More... | |
| static void | sai_hal_set_rx_fbt (uint8_t instance, uint8_t index) |
| Sets the index in FIFO for the first bit data. More... | |
| bool | sai_hal_mclk_divider_is_update (uint8_t instance) |
| Flags whether the master clock divider is re-divided. More... | |
| bool | sai_hal_word_start_is_detected (uint8_t instance, sai_io_mode_t io_mode) |
| Word start is detected. More... | |
| bool | sai_hal_sync_error_is_detected (uint8_t instance, sai_io_mode_t io_mode) |
| Sync error is detected. More... | |
| bool | sai_hal_fifo_warning_is_detected (uint8_t instance, sai_io_mode_t io_mode) |
| FIFO warning is detected. More... | |
| bool | sai_hal_fifo_error_is_detected (uint8_t instance, sai_io_mode_t io_mode) |
| FIFO error is detected. More... | |
| bool | sai_hal_fifo_request_is_detected (uint8_t instance, sai_io_mode_t io_mode) |
| FIFO request is detected. More... | |
| static void | sai_hal_receive_data (uint8_t instance, uint8_t rx_channel, uint32_t *data) |
| Receives the data from FIFO. More... | |
| static void | sai_hal_transmit_data (uint8_t instance, uint8_t tx_channel, uint32_t data) |
| Transmits data to the FIFO. More... | |
| enum sai_bus_t |
| enum sai_io_mode_t |
| enum sai_master_slave_t |
| enum sai_sync_mode_t |
| enum sai_mclk_source_t |
| enum sai_bclk_source_t |
| enum sai_dma_request_t |
| enum sai_state_flag_t |
| enum sai_reset_type_t |
| enum sai_mode_t |
| void sai_hal_init | ( | uint8_t | instance | ) |
The initialization resets the SAI module by setting the SR bit of TCSR and the RCSR register. Note that the function would write 0 to every control registers.
| instance | The SAI peripheral instance number. |
| void sai_hal_set_tx_bus | ( | uint8_t | instance, |
| sai_bus_t | bus_mode | ||
| ) |
The bus mode means which protocol SAI uses. It can be I2S left, right, and so on. Each protocol would have different configuration on bit clock and frame sync.
| instance | The SAI peripheral instance number. |
| bus_mode | The protocol selection, it can be I2S left aligned, I2S right aligned, etc. |
| void sai_hal_set_rx_bus | ( | uint8_t | instance, |
| sai_bus_t | bus_mode | ||
| ) |
The bus mode means which protocol SAI uses. It can be I2S left, right and so on. Each protocol has a different configuration on bit clock and frame sync.
| instance | The SAI peripheral instance number. |
| bus_mode | The protocol selection, it can be I2S left aligned, I2S right aligned, etc. |
|
inlinestatic |
The source of the clock can be: PLL_OUT, ALT_CLK, EXTAL, SYS_CLK. This function sets the clock source for SAI master clock source. Master clock is used to produce the bit clock for the data transfer.
| instance | The SAI peripheral instance number. |
| source | Mater clock source |
| void sai_hal_set_mclk_divider | ( | uint8_t | instance, |
| uint32_t | mclk, | ||
| uint32_t | src_clk | ||
| ) |
Using the divider to get the master clock frequency wanted from the source. mclk = clk_source * fract/divide. The input is the master clock frequency needed and the source clock frequency. The master clock is decided by the sample rate and the multi-clock number.
| instance | The SAI peripheral instance number. |
| mclk | Master clock frequency needed. |
| src_clk | The source clock frequency. |
|
inlinestatic |
It is generated by the master clock, bus clock, and other devices.
The function sets the source of the bit clock. The bit clock can be produced by the master clock, and from the bus clock or other SAI Tx/Rx. Tx and Rx in the SAI module can use the same bit clock either from Tx or Rx.
| instance | The SAI peripheral instance number. |
| source | Bit clock source. |
|
inlinestatic |
It is generated by the master clock, bus clock, and other devices.
The function sets the source of the Rx bit clock. The bit clock can be produced by the master clock and from the bus clock or other SAI Tx/Rx. Tx and Rx in the SAI module use the same bit clock either from Tx or Rx.
| instance | The SAI peripheral instance number. |
| source | Bit clock source. |
|
inlinestatic |
bclk = mclk / divider. At the same time, bclk = sample_rate * channel * bits. This means how much time is needed to transfer one bit. Notice: The function is called while the bit clock source is the master clock.
| instance | The SAI peripheral instance number. |
| div | The divide number of bit clock. |
|
inlinestatic |
bclk = mclk / divider. At the same time, bclk = sample_rate * channel * bits. This means how much time is needed to transfer one bit. Notice: The function is called while the bit clock source is the master clock.
| instance | The SAI peripheral instance number. |
| div | The divide number of bit clock. |
|
inlinestatic |
The frame size means how many words are in a frame. For example 2-channel audio data, the frame size is 2. This means there are 2 words in a frame.
| instance | The SAI peripheral instance number. |
| size | Words number in a frame. |
|
inlinestatic |
The frame size means how many words in a frame. In the usual case, for example 2-channel audio data, the frame size is 2, means 2 words in a frame.
| instance | The sai peripheral instance number. |
| size | Words number in a frame. |
|
inlinestatic |
The word size means the quantization level of audio file. Generally, there are 8bit, 16bit, 24bit, 32bit format which sai would all support.
| instance | The sai peripheral instance number. |
| bits | How many bits in a word. |
|
inlinestatic |
The word size means the quantization level of the audio file. Generally, SAI supports 8 bit, 16 bit, 24 bit, and 32 bit formats.
| instance | The SAI peripheral instance number. |
| bits | How many bits in a word. |
|
inlinestatic |
In I2S protocol, the size of the first word is the same as the size of other words. In some protocols, for example, AC'97, the size of the first word is not the same as other sizes. This function sets the length of the first word which is, in most situations, the same as others.
| instance | The SAI peripheral instance number. |
| size | The length of frame head word. |
|
inlinestatic |
In I2S protocol, the size of the first word is the same as the size of other words. In some protocols, for example, AC'97, the first word is not the same size as others. This function sets the length of the first word, which is, in most situations, the same as others.
| instance | The SAI peripheral instance number. |
| size | The length of frame head word. |
|
inlinestatic |
A sync is the number of bit clocks of a frame. The sync width cannot be longer than the length of the first word of the frame.
| instance | The SAI peripheral instance number. |
| width | How many bit clock in a sync. |
|
inlinestatic |
A sync is the number of bit clocks of a frame. The sync width cannot be longer than the length of the first word of the frame.
| instance | The SAI peripheral instance number. |
| width | How many bit clock in a sync. |
|
inlinestatic |
While the value in the Tx FIFO is less or equal to the watermark , it generates an interrupt request or a DMA request. The watermark value cannot be greater than the depth of FIFO.
| instance | The SAI peripheral instance number. |
| watermark | Watermark value of a FIFO. |
|
inlinestatic |
While the value in Rx FIFO is larger or equal to the watermark , it generates an interrupt request or a DMA request. The watermark value cannot be greater than the depth of FIFO.
| instance | The SAI peripheral instance number. |
| watermark | Watermark value of a FIFO. |
| void sai_hal_set_tx_master_slave | ( | uint8_t | instance, |
| sai_master_slave_t | master_slave_mode | ||
| ) |
The function sets the Tx mode to either master or slave. The master mode provides its own clock and slave mode uses the external clock.
| instance | The SAI peripheral instance number. |
| master_slave_mode | Mater or slave mode. |
| void sai_hal_set_rx_master_slave | ( | uint8_t | instance, |
| sai_master_slave_t | master_slave_mode | ||
| ) |
The function sets the Rx mode to either master or slave. Master mode provides its own clock and slave mode uses the external clock.
| instance | The SAI peripheral instance number. |
| master_slave_mode | Mater or slave mode. |
| void sai_hal_set_tx_sync_mode | ( | uint8_t | instance, |
| sai_sync_mode_t | sync_mode | ||
| ) |
The mode can be asynchronous mode, synchronous, or synchronous with another SAI device. When configured for a synchronous mode of operation, the receiver must be configured for the asynchronous operation.
| instance | The SAI peripheral instance number. |
| sync_mode | Synchronous mode or Asynchronous mode. |
| void sai_hal_set_rx_sync_mode | ( | uint8_t | instance, |
| sai_sync_mode_t | sync_mode | ||
| ) |
The mode can be asynchronous mode, synchronous, synchronous with another SAI device. When configured for a synchronous mode of operation, the receiver must be configured for the asynchronous operation.
| instance | The SAI peripheral instance number. |
| sync_mode | Synchronous mode or Asynchronous mode. |
| uint8_t sai_hal_get_fifo_read_pointer | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode, | ||
| uint8_t | fifo_channel | ||
| ) |
It is used to judge whether the FIFO is full or empty and know how much space there is for FIFO. If read_ptr == write_ptr, the FIFO is empty. While the bit of the read_ptr and the write_ptr are equal except for the MSB, the FIFO is full.
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| fifo_channel | FIFO channel selected. |
| uint8_t sai_hal_get_fifo_write_pointer | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode, | ||
| uint8_t | fifo_channel | ||
| ) |
It is used to judge whether the FIFO is full or empty and know how much space there is for FIFO. If the read_ptr == write_ptr, the FIFO is empty. While the bit of the read_ptr and write_ptr are equal except for the MSB, the FIFO is full.
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| fifo_channel | FIFO channel selected. |
| uint32_t* sai_hal_get_fifo_address | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode, | ||
| uint8_t | fifo_channel | ||
| ) |
This function is for DMA transfer because it needs to know the dest/src address of the DMA transfer.
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| fifo_channel | FIFO channel selected. |
|
inlinestatic |
Enables the transmitter. This function enables both the bit clock and the transfer channel.
| instance | The SAI peripheral instance number. |
|
inlinestatic |
Enables the receiver. This function enables both the bit clock and the receive channel.
| instance | The SAI peripheral instance number. |
|
inlinestatic |
Disables the transmitter. This function disables both the bit clock and the transfer channel. When software clears this field, the transmitter remains enabled, and this bit remains set, until the end of the current frame.
| instance | The SAI peripheral instance number. |
|
inlinestatic |
Disables the receiver. This function disables both the bit clock and the transfer channel. When software clears this field, the receiver remains enabled, and this bit remains set, until the end of the current frame.
| instance | The SAI peripheral instance number. |
| void sai_hal_enable_tx_interrupt | ( | uint8_t | instance, |
| sai_interrupt_request_t | source | ||
| ) |
The interrupt source can be : Word start flag, Sync error flag, FIFO error flag, FIFO warning flag, FIFO request flag. This function sets which flag causes an interrupt request.
| instance | The SAI peripheral instance number. |
| source | SAI interrupt request source. |
| void sai_hal_enable_rx_interrupt | ( | uint8_t | instance, |
| sai_interrupt_request_t | source | ||
| ) |
The interrupt source can be : Word start flag, Sync error flag, FIFO error flag, FIFO warning flag, FIFO request flag. This function sets which flag causes an interrupt request.
| instance | The SAI peripheral instance number. |
| source | SAI interrupt request source. |
| void sai_hal_disable_tx_interrupt | ( | uint8_t | instance, |
| sai_interrupt_request_t | source | ||
| ) |
This function disables the interrupt requests from the interrupt request source of SAI.
| instance | The SAI peripheral instance number. |
| source | SAI interrupt request source. |
| void sai_hal_disable_rx_interrupt | ( | uint8_t | instance, |
| sai_interrupt_request_t | source | ||
| ) |
This function disables the interrupt requests from interrupt request source of SAI.
| instance | The SAI peripheral instance number. |
| source | SAI interrupt request source. |
| void sai_hal_enable_tx_dma | ( | uint8_t | instance, |
| sai_dma_request_t | request | ||
| ) |
The DMA sources can be FIFO warning and FIFO request. This function enables the DMA request from different DMA request sources.
| instance | The SAI peripheral instance number. |
| source | SAI DMA request source. |
| void sai_hal_enable_rx_dma | ( | uint8_t | instance, |
| sai_dma_request_t | request | ||
| ) |
The DMA sources can be: FIFO warning and FIFO request. This function enables the DMA request from different DMA request sources.
| instance | The SAI peripheral instance number. |
| source | SAI DMA request source. |
| void sai_hal_disable_tx_dma | ( | uint8_t | instance, |
| sai_dma_request_t | request | ||
| ) |
The function disables the DMA request of Tx in SAI. DMA request can from FIFO warning or FIFO request which means FIFO is empty or reach the watermark.
| instance | The SAI peripheral instance number. |
| source | SAI DMA request source. |
| void sai_hal_disable_rx_dma | ( | uint8_t | instance, |
| sai_dma_request_t | request | ||
| ) |
The function disables the DMA request of Tx in SAI. DMA request can from FIFO warning or FIFO request which means FIFO is empty or reach the watermark.
| instance | The SAI peripheral instance number. |
| source | SAI DMA request source. |
| void sai_hal_clear_tx_state_flag | ( | uint8_t | instance, |
| sai_state_flag_t | flag | ||
| ) |
The function is used to clear the flags manually. It can clear word start, FIFO warning, FIFO error, and FIFO request flag.
| instance | The SAI peripheral instance number. |
| flag | SAI state flag type. The flag can be word start, sync error, FIFO error/warning. |
| void sai_hal_clear_rx_state_flag | ( | uint8_t | instance, |
| sai_state_flag_t | flag | ||
| ) |
The function clears the flags manually. It can clear word start, FIFO warning, FIFO error, and FIFO request flag.
| instance | The SAI peripheral instance number. |
| flag | SAI state flag type. The flag can be word start, sync error, FIFO error/warning. |
| void sai_hal_reset_tx | ( | uint8_t | instance, |
| sai_reset_type_t | mode | ||
| ) |
There are two kinds of reset: Software reset and FIFO reset. Software reset: resets all transmitter internal logic, including the bit clock generation, status flags and FIFO pointers. It does not reset the configuration registers. FIFO reset: synchronizes the FIFO write pointer to the same value as the FIFO read pointer. This empties the FIFO contents and is to be used after the Transmit FIFO Error Flag is set, and before the FIFO is re-initialized and the Error Flag is cleared.
| instance | The SAI peripheral instance number. |
| mode | SAI reset type. |
| void sai_hal_reset_rx | ( | uint8_t | instance, |
| sai_reset_type_t | mode | ||
| ) |
| instance | The SAI peripheral instance number. |
| mode | SAI reset type. |
|
inlinestatic |
Each bit number represent the mask word index. For example, 0 represents mask the 0th word, 3 represents mask 0th and 1st word. The TMR register can be different from frame to frame. If the user wants a mono audio, set the mask to 0/1.
| instance | The SAI peripheral instance number. |
| mask | Which bits need to be masked in a frame. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| mask | Which bits need to be masked in a frame. |
|
inlinestatic |
A SAI instance includes a Tx and a Rx. Each has several channels according to different platforms. A channel means a path for the audio data input/output.
| instance | The SAI peripheral instance number. |
| fifo_channel | FIFO channel number. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| fifo_channel | FIFO channel number. |
| void sai_hal_set_tx_mode | ( | uint8_t | instance, |
| sai_mode_t | mode | ||
| ) |
There is a debug mode, stop mode and a normal mode.
This function can set the working mode of the SAI instance. Stop mode is always used in low power cases, and the debug mode disables the SAI after the current transmit/receive is completed.
| instance | The SAI peripheral instance number. |
| mode | SAI running mode. |
| void sai_hal_set_rx_mode | ( | uint8_t | instance, |
| sai_mode_t | mode | ||
| ) |
| instance | The SAI peripheral instance number. |
| mode | SAI running mode. |
| void sai_hal_set_tx_bclk_swap | ( | uint8_t | instance, |
| bool | ifswap | ||
| ) |
While set in asynchronous mode, the transmitter is clocked by the receiver bit clock. When set in synchronous mode, the transmitter is clocked by the transmitter bit clock, but uses the receiver frame sync. This bit has no effect when synchronous with another SAI peripheral.
| instance | The SAI peripheral instance number. |
| ifswap | If swap bit clock. |
| void sai_hal_set_rx_bclk_swap | ( | uint8_t | instance, |
| bool | ifswap | ||
| ) |
When set in asynchronous mode, the receiver is clocked by the transmitter bit clock. When set in synchronous mode, the receiver is clocked by the receiver bit clock, but uses the transmitter frame sync. This bit has no effect when synchronous with another SAI peripheral.
| instance | The SAI peripheral instance number. |
| ifswap | If swap bit clock. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| index | Which word triggers the word start flag. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| index | Which word would trigger word start flag. |
|
inlinestatic |
The FIFO is 32-bit in SAI, but not all audio data is 32-bit. Mostly they are 16-bit. In this situation, the Codec needs to know which bit of the FIFO marks the valid audio data.
| instance | The SAI peripheral instance number. |
| index | First bit shifted in FIFO. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| index | First bit shifted in FIFO. |
| bool sai_hal_mclk_divider_is_update | ( | uint8_t | instance | ) |
| instance | The SAI peripheral instance number. |
| bool sai_hal_word_start_is_detected | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode | ||
| ) |
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| bool sai_hal_sync_error_is_detected | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode | ||
| ) |
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| bool sai_hal_fifo_warning_is_detected | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode | ||
| ) |
FIFO warning means that the FIFO is empty in Tx. While in Tx, FIFO warning means that the FIFO is empty and it needs data.
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| bool sai_hal_fifo_error_is_detected | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode | ||
| ) |
FIFO error means that the FIFO has no data and the Codec is still transferring data. While in Rx, FIFO error means that the data is still in but the FIFO is full.
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
| bool sai_hal_fifo_request_is_detected | ( | uint8_t | instance, |
| sai_io_mode_t | io_mode | ||
| ) |
FIFO request means that the data in FIFO is less than the watermark in Tx and more than the watermark in Rx.
| instance | The SAI peripheral instance number. |
| io_mode | Transmit or receive data. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| rx_channel | Rx FIFO channel. |
| data | Pointer to the address to be written in. |
|
inlinestatic |
| instance | The SAI peripheral instance number. |
| tx_channel | Tx FIFO channel. |
| data | Data value which needs to be written into FIFO. |